Fix reftests for builddir != srcdir
authorMatthias Clasen <mclasen@redhat.com>
Sun, 10 Aug 2014 23:05:50 +0000 (19:05 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 10 Aug 2014 23:11:39 +0000 (19:11 -0400)
Make gtk-reftest consult the REFTEST_MODULE_DIR environment
variable to find out where to look for modules, and fix the
libtool hack to construct the .libs subdirectory correctly.

testsuite/reftests/Makefile.am
testsuite/reftests/gtk-reftest.c
testsuite/reftests/reftest-module.c

index 2607ecc8c73bcc0d70712238de4ef9ecb5fe24d1..8501c34ab674b41ab1fbf064b4db43e2da1492ef 100644 (file)
@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.decl
 NULL =
 
 TESTS_ENVIRONMENT =                            \
+       REFTEST_MODULE_DIR=$(abs_builddir)      \
        GTK_IM_MODULE=gtk-im-context-simple     \
        GSETTINGS_BACKEND=memory                \
        G_ENABLE_DIAGNOSTIC=0
index d4323346be52b8f5e87b6530549b98eeabda2872..a9da81bd5882390a42ad2110425dcdddac8f08c4 100644 (file)
@@ -381,10 +381,12 @@ connect_signals (GtkBuilder    *builder,
         }
       break;
     case 2:
+      if (g_getenv ("REFTEST_MODULE_DIR"))
+        directory = g_getenv ("REFTEST_MODULE_DIR");
       module = reftest_module_new (directory, split[0]);
       if (module == NULL)
         {
-          g_error ("Could not load module '%s' when looking up '%s'", split[0], handler_name);
+          g_error ("Could not load module '%s' from '%s' when looking up '%s'", split[0], directory, handler_name);
           return;
         }
       func = reftest_module_lookup (module, split[1]);
@@ -438,6 +440,7 @@ snapshot_ui_file (const char *ui_file)
   gtk_builder_connect_signals_full (builder, connect_signals, directory);
   window = builder_get_toplevel (builder);
   g_object_unref (builder);
+  g_free (directory);
   g_assert (window);
 
   gtk_widget_show (window);
index 536b34d0ec935f5abdffef67938d0ea3ef685503..78fd1833aa0a36f0b28974fac12a1c458d5c25be 100644 (file)
@@ -99,7 +99,7 @@ reftest_module_new (const char *directory,
   if (module == NULL)
     {
       /* libtool hack */
-      char *libtool_dir = g_build_path (directory, ".libs", NULL);
+      char *libtool_dir = g_build_filename (directory, ".libs", NULL);
 
       g_free (full_path);
       full_path = g_module_build_path (libtool_dir, module_name);